#include "SimpleObject.hpp"
#include <math.h>
#include <vector>
#include "Behaviour.hpp"


namespace se {
    
void SimpleObject::Act(Instance& i)
{
    for(std::vector<Behaviour*>::iterator it = m_behaviour.begin(); it!= m_behaviour.end(); it++)
    {
        (*it)->Behave(this, i);
    }
}

float SimpleObject::Distance(Position p)
{
    float dist = 0;
    Position pSelf = this->sf::Drawable::GetPosition();
    
    dist = sqrt((pSelf.x-p.x)*(pSelf.x-p.x)+(pSelf.y-p.y)*(pSelf.y-p.y));
    
    return dist;
}

float SimpleObject::Distance(SimpleObject* s)
{
    float dist = 0;
    Position p = s->sf::Drawable::GetPosition();
    Position pSelf = this->sf::Drawable::GetPosition();
    
    dist = sqrt((pSelf.x-p.x)*(pSelf.x-p.x)+(pSelf.y-p.y)*(pSelf.y-p.y));
    
    return dist;
}

bool SimpleObject::Touch(SimpleObject* object) // detecte si deux SimpleObject sont en contact
{
	// TODO : Implement bool SimpleObject::Touch(SimpleObject* object) or remove it
	object=object;
	return true;
}

}//</namespace se>
